﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;

using Report.Helper;
using Report.Entity;
using Report.Repository;

// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace Report.Controllers
{
    /// <summary>
    /// 仓位
    /// </summary>
    [Route("api/[controller]")]
    public class PositionController : Controller
    {
        private PositionDAL DAL = new PositionDAL();
        /// <summary>
        /// 根据仓位查询
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("search")]
        public JsonResult Search([FromBody]Newtonsoft.Json.Linq.JObject para)
        {
            string position = para["position"].ToString();

            仓库仓位 entity = DAL.SearchByPosition(position);
            if (entity == null)
            {
                return Json(new { recode = 0, msg = "无效仓位" });
            }

            return Json(new { recode = 1, msg = "有效仓位" });
        }
    }
}
